package jmine.tec.utils.reflection.fast.asm;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import jmine.tec.utils.reflection.fast.FastMethodSingleArgument;

/**
 * @author takeshi
 */
public class FastMethodSingleArg extends FastMethodImpl implements FastMethodSingleArgument {

    /**
     * C'tor
     * 
     * @param index o indice
     * @param method o {@link Method}
     * @param gen o accessor
     */
    public FastMethodSingleArg(int index, Method method, GeneratedFastClassAccessor gen) {
        super(index, method, gen);
    }

    /**
     * {@inheritDoc}
     */
    public Object invokeSingleArgument(Object target, Object arg) throws InvocationTargetException {
        try {
            return this.generated.invokeMethodSingleArg(this.index, target, arg);
        } catch (RuntimeException e) {
            throw e;
        } catch (Error e) {
            throw e;
        } catch (Exception e) {
            throw new InvocationTargetException(e);
        }
    }

}
